package com.redhat.redwork.widget;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.UIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;

import com.opensymphony.xwork2.util.ValueStack;

@StrutsTag(name = "gridToolbar", tldTagClass = "", description = "toolbar for Grid")
public class GridToolbar extends UIBean{

	public static final String            TEMPLATE       = "gridtoolbar";
    
    protected String grid; 
    
	public GridToolbar(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	@Override
	protected void evaluateExtraParams() {
		super.evaluateExtraParams();

		addParameter("grid", findString(grid));
	}
	
	@Override
	@StrutsTagSkipInheritance
	public void setTheme(String theme) {
		super.setTheme(theme);
	}
	
	@Override
	public String getTheme() {
		return "redwork";
	}

	@Override
	protected String getDefaultTemplate() {
		return TEMPLATE;
	}
	
	@StrutsTagAttribute(description = "target grid")
	public void setGrid(String grid) {
		this.grid = grid;
	}
}
